- /* sdmfixpt.cpp by K.Tsuru */
- // function ID = 312, 313
- /*********************************************************
- SDouble and SDecimal classes
- It provides functions for fixed point mode.
- **********************************************************/
- #ifndef SN_H
- #include "sn.h"
- #endif
-
- /**********************************************************************
- It goes into the fixed point mode by giving the value of fixed exponent.
- In the summation of series it fixes the number of effective figures and
- decreases the number of figures to evaluate.
- It does not reduce the size by Reform() and does not change the exponent.
- The functions FixedPoint() and PointFree() must make a pair, and called by
- the same object.
- ***********************************************************************/
- int SDouble::fixedExp = 0;
- int SDouble::fixedPointMode = 0;
-
- static SNStack <int> fixedExpStack; // ver. 2.18
-
- // function ID = 312 DRADIX
- void SDouble::FixedPoint(int exp){
- if(!fixedExpStack.Elements()){
- fixedExpStack.Push(0);
- }
- if(CutDown() != DISABLE){
- CutDown(DISABLE);
- PushCD(PushedCD() | SD_PUSH);
- }
- if(fixedExp != exp){
- fixedExpStack.Push(fixedExp);
- PushCD(PushedCD() | CH_FE);
- fixedExp = exp;
- }
- fixedPointMode++;
- }
- // function ID = 313 DRADIX
- void SDouble::PointFree(){
- if( PushedCD() & SD_PUSH ){
- PushCD(PushedCD() & ~SD_PUSH);
- CutDown(POP);
- }
- if(PushedCD() & CH_FE){
- fixedExp = fixedExpStack.Pop();
- PushCD(PushedCD() & ~CH_FE);
- }
- int c = fixedPointMode/(FIXED_PT_MASK+1) + (fixedPointMode & FIXED_PT_MASK);
- fixedPointMode--;
- if(!c || (fixedPointMode < 0) ) SetError(SYNTAX_ERR,"PointFree", 313);
- }
-
sdmfixpt.cpp : last modifiled at 2016/09/04 14:21:40(1,690 bytes)
created at 2017/10/07 10:21:15
The creation time of this html file is 2017/10/07 10:30:03 (Sat Oct 07 10:30:03 2017).